{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import torch\n",
    "import librosa\n",
    "import pickle\n",
    "from synthesis import build_model\n",
    "from synthesis import wavegen\n",
    "\n",
    "spect_vc = pickle.load(open('results.pkl', 'rb'))\n",
    "device = torch.device(\"cuda\")\n",
    "model = build_model().to(device)\n",
    "checkpoint = torch.load(\"checkpoint_step001000000_ema.pth\")\n",
    "model.load_state_dict(checkpoint[\"state_dict\"])\n",
    "\n",
    "for spect in spect_vc:\n",
    "    name = spect[0]\n",
    "    c = spect[1]\n",
    "    print(name)\n",
    "    waveform = wavegen(model, c=c)   \n",
    "    librosa.output.write_wav(name+'.wav', waveform, sr=16000)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
